package com.ideaaedi.zoo.example.flowableui;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.io.File;
import java.io.IOException;

/**
 * 你可以运行此项目，然后在本地进行bpmn文档设计
 *
 * @author <font size = "20" color = "#3CAA3C"><a href="https://gitee.com/JustryDeng">JustryDeng</a></font> <img
 * src="https://gitee.com/JustryDeng/shared-files/raw/master/JustryDeng/avatar.jpg" />
 * @since 1.0.0
 */
@SpringBootApplication
public class FlowableUiApplication {
    
    static {

        File dbFile = new File("D:\\data\\tmp\\flowable_ui_db");
        if (!dbFile.getParentFile().exists()) {
            dbFile.getParentFile().mkdirs();
        }
        if (!dbFile.exists()) {
            try {
                //noinspection ResultOfMethodCallIgnored
                dbFile.createNewFile();
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }
    }
    
    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(FlowableUiApplication.class, args);
        Environment env = application.getEnvironment();
        System.err.println();
        System.err.println();
        System.err.printf(
                "访问：http://127.0.0.1:%s 进行bpmn文档设计（账密：admin/test）",
                env.getProperty("server.port", "8080")
        );
        System.err.println();
        System.err.println();
        System.err.println();
        System.err.println();
    }
}
